# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
  def url_prefix
   APP_CONFIG[:url_prefix]
  end

  def clippy(text, bgcolor='#FFFFFF')
    html = <<-EOF
      <object classid="clippy"
            width="110"
            height="14"
            id="clippy" >
      <param name="movie" value="#{url_prefix}/flash/clippy.swf"/>
      <param name="allowScriptAccess" value="always" />
      <param name="quality" value="high" />
      <param name="scale" value="noscale" />
      <param NAME="FlashVars" value="text=#{text}">
      <param name="bgcolor" value="#{bgcolor}">
      <embed src="#{url_prefix}/flash/clippy.swf"
           width="110"
           height="14"
           name="clippy"
           quality="high"
           allowScriptAccess="always"
           type="application/x-shockwave-flash"
           pluginspage="http://www.macromedia.com/go/getflashplayer"
           FlashVars="text=#{CGI::escape(text)}"
           bgcolor="#{bgcolor}"
      />
      </object>
    EOF
  end

  def AS_select(options, select_options)
    "<select id='#{options[:id]}', name='#{options[:name]}', class='#{options[:class]}'>
    #{options_for_select(select_options)}
    </select>"
  end
end
